package cn.yangliu.nacos.oauth2.service;

import cn.yangliu.jpa.base.service.JpaService;
import cn.yangliu.nacos.comm.model.Oauth2UserModel;
import cn.yangliu.nacos.comm.model.Oauth2UserQueryModel;
import cn.yangliu.nacos.oauth2.entity.User;
import org.springframework.security.core.userdetails.UserDetailsService;

/**
 * The interface User service.
 *
 * @author 问道于盲
 * @date 2019 -03-20 00:08
 */
public interface UserService extends UserDetailsService, JpaService<User, Long> {

    /**
     * Insert oauth 2 user model.
     *
     * @param user the user
     * @return the oauth 2 user model
     */
    Oauth2UserModel insert(User user);

    /**
     * Update oauth 2 user model.
     *
     * @param user the user
     * @return the oauth 2 user model
     */
    Oauth2UserModel update(User user);

    /**
     * Update password boolean.
     *
     * @param password the password
     * @param id       the id
     * @return the boolean
     */
    boolean updatePassword(String password, Long id);

    /**
     * Delete user boolean.
     *
     * @param id the id
     * @return the boolean
     */
    boolean deleteUser(Long id);

    /**
     * Find user oauth 2 user model.
     *
     * @param model the model
     * @return the oauth 2 user model
     */
    Oauth2UserModel findUser(Oauth2UserQueryModel model);

    /**
     * Check exist boolean.
     *
     * @param model the model
     * @return the boolean
     */
    boolean checkExist(Oauth2UserQueryModel model);
}
